# -*- coding: utf-8 -*-
'''
@author: Hugo
@file: font_encode.py
@time: 2021/9/1 23:23
'''
import requests
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3875.400 QQBrowser/10.8.4492.400',
    'Referer': 'https://maoyan.com/films/1218188'
}

def index():
    url = 'https://maoyan.com/films/1218188'
    res = requests.get(url,headers = headers)
    with open(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\xl.html','wt',encoding = 'utf-8') as f:
        f.write(res.text)

def get_font():
    font_size ='http://vfile.meituan.net/colorstone/fc6f6a6215b5fa27fe98f265516e4e642272.woff'
    res1 = requests.get(font_size,headers = headers)
    with open(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\ff.woff','wb') as f1:
        f1.write(res1.content)

from fontTools.ttLib import TTFont
# get_font()
xl = TTFont(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\xl.woff')
xl.saveXML(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\xl.xml')
ff = TTFont(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\ff.woff')
ff.saveXML(r'D:\TulingPaCong\day18CSS偏移字体反爬\字体反爬\ff.xml')








